<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        // function Grand(){}
        // function Parent(){}
        // Grand.prototype.tskill='拉二胡'
        // var grand=new Grand();
        // // Parent.prototype=grand;
        // var parent=new Parent();
        // Parent.prototype.tskill='弹琴';
        // console.log(parent.tskill);
        // console.log(grand.tskill);

        // // 1. 
        function Test(){
        this.name = name;
        this.age = age;
        }
        obj = {}
        // Test.apply(obj,[name='拉拉',age=15])
        Test.call(obj,name='拉拉',age=15)
        console.log(obj);
        // 分别使用call，apply为obj添加name，age属性
//         2.
//      实现陈鹏买车，其中有sayHi方法，功能:打印'陈鹏买了一辆红色的2.0宝马车'


        // 3.父类Shape （属性有:name,length,width,方法有:Intro 我是XX形）

        // 子类： Circle(属性有:r)

        // 分别使用 原型链继承 构造函数继承 圣杯继承
        function Shape (){}
        function Circle(){}
        Shape.prototype.name='呼呼'
        var shape=new Shape();
        Circle.prototype=shape;
        var circle= new Circle();
        circle.__proto__.r='2.5';
        console.log(circle.r);



        function Shape (name){
            this.name=name
        }
        function Circle(r,name){
            
            Shape.call(this,name)
            this.r=r
        }
        var circle = new Circle(2,'呼呼')
    
        console.log(circle.name);




        
        function Shape (){}
        function Circle(){}
        Shape.prototype.name='呼呼'
        function inherit(Target,Origin){
            function f(){}
            f.prototype=Origin.prototype;
            Target.prototype=new f()
            Target.prototype.constructor=Target;
            Target.prototype.uber=Origin;
        }
        inherit(Circle,Shape);
        var circle=new Circle();
        console.log(circle);

    </script>
</body>
</html>